//
//  GGTabBarViewController.m
//  DDLock
//
//  Created by ios on 2017/12/25.
//  Copyright © 2017年 saiyi. All rights reserved.
//

#import "GGTabBarViewController.h"
#import "GGNavViewController.h"

#import "GGMeViewController.h"

@interface GGTabBarViewController ()

@end

@implementation GGTabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    
    [self _setAddChild:@"GGShopViewController" image:@"tab_shop_nomal" selectedImage:@"tab_shop_select" title:@"乐购"];
    [self _setAddChild:@"GGDeviceViewController" image:@"tab_device_normal" selectedImage:@"tab_device_select" title:@"设备"];
    [self _setAddChild:@"GGMeViewController" image:@"tab_me_normal" selectedImage:@"tab_me_select" title:@"我的"];
    
}

#pragma mark - private

- (void)_setAddChild:(NSString *)vcStr image:(NSString *)image selectedImage:(NSString *)selectedImage title:(NSString *)title {
    
    Class class = NSClassFromString(vcStr);
    UIViewController *vc = [class share];
    
    GGNavViewController *nav = [[GGNavViewController alloc] initWithRootViewController:vc];
    nav.tabBarItem.image = [UIImage imageNamed:image];
    nav.tabBarItem.selectedImage = [UIImage imageNamed:selectedImage];
    nav.tabBarItem.title = title;
    
//    [nav.tabBarItem setTitleTextAttributes:@{NSFontAttributeName : [UIFont systemFontOfSize:12], NSForegroundColorAttributeName : kCommongrayColor} forState:UIControlStateNormal];
    [nav.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName : kCommonBlueColor} forState:UIControlStateSelected];
    
    [self addChildViewController:nav];
    
}




@end
